package com.yunxiao.cloud.mail.entity;

import org.thymeleaf.context.Context;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 邮件表
 * </p>
 *
 * @author yunxiao
 * @since 2020-01-16
 */
public class Mail implements Serializable {

    private static final long serialVersionUID = 1842594486012663488L;
    /**
     * 主键ID
     */
    private Integer id;

    /**
     * 发件人邮箱
     */
    private String fromEmail;

    /**
     * 密码
     */
    private String password;

    /**
     * 接收人邮箱(多个逗号分开)
     */
    private String toEmail;

    /**
     * 抄送人邮箱(多个逗号分开)
     */
    private String copyTo;

    /**
     * 主题
     */
    private String subject;

    /**
     * 是否是html
     */
    private boolean html;

    /**
     * 发送内容
     */
    private String content;

    /**
     * 模板
     */
    private String template;

    /**
     * freemarker 模板参数
     */
    private Map<String, Object> templateMap;

    /**
     * thymlef 模板参数
     */
    private Context context;

    /**
     * 附件
     */
    private List<EmailAttachment> emailAttachment;
    /**
     * 静态资源（多为图片）
     * 映入静态资源时 资源id要与文本中的名称一致
     */
    private InlineFile inlineFile;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }


    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getFromEmail() {
        return fromEmail;
    }

    public void setFromEmail(String fromEmail) {
        this.fromEmail = fromEmail;
    }

    public String getToEmail() {
        return toEmail;
    }

    public void setToEmail(String toEmail) {
        this.toEmail = toEmail;
    }

    public List<EmailAttachment> getEmailAttachment() {
        return emailAttachment;
    }

    public void setEmailAttachment(List<EmailAttachment> emailAttachment) {
        this.emailAttachment = emailAttachment;
    }

    public InlineFile getInlineFile() {
        return inlineFile;
    }

    public void setInlineFile(InlineFile inlineFile) {
        this.inlineFile = inlineFile;
    }

    public static class EmailAttachment implements Serializable{

        private static final long serialVersionUID = -2244840642810789930L;
        /**
         * 附件文件名
         */
        private String fileName;
        /**
         * 附件文件地址
         */
        private String filePath;

        /**
         * 全参构造函数
         * @param fileName 文件名
         * @param filePath 文件路径
         */
        public EmailAttachment(String fileName, String filePath) {
            this.fileName = fileName;
            this.filePath = filePath;
        }

        public String getFileName() {
            return fileName;
        }

        public void setFileName(String fileName) {
            this.fileName = fileName;
        }

        public String getFilePath() {
            return filePath;
        }

        public void setFilePath(String filePath) {
            this.filePath = filePath;
        }
    }

    public static class InlineFile implements Serializable{
        private static final long serialVersionUID = -7767304171842781499L;
        /**
         * 资源id
         */
        private String contentId;
        /**
         * 资源地址
         */
        private String filePath;

        /**
         * 全参构造函数
         * @param contentId 资源id
         * @param filePath 资源地址
         */
        public InlineFile(String contentId, String filePath) {
            this.contentId = contentId;
            this.filePath = filePath;
        }

        public String getContentId() {
            return contentId;
        }

        public void setContentId(String contentId) {
            this.contentId = contentId;
        }

        public String getFilePath() {
            return filePath;
        }

        public void setFilePath(String filePath) {
            this.filePath = filePath;
        }
    }

    public Map<String, Object> getTemplateMap() {
        return templateMap;
    }

    public void setTemplateMap(Map<String, Object> templateMap) {
        this.templateMap = templateMap;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public String getCopyTo() {
        return copyTo;
    }

    public void setCopyTo(String copyTo) {
        this.copyTo = copyTo;
    }

    public boolean isHtml() {
        return html;
    }

    public void setHtml(boolean html) {
        this.html = html;
    }
}
